package com.demo.flink

import org.apache.flink.api.scala.{ExecutionEnvironment, createTypeInformation}

object HdfsSource {
  def main(args: Array[String]): Unit = {
    val env = ExecutionEnvironment.getExecutionEnvironment
    val filepath = args(0)
    //val filepath = "hdfs://hadoop-master:8020/user/hy.csv"
    //val filepath = "file:///c:/data/hy.csv"
    val lines = env.readTextFile(filepath)
    val result = lines.map(line=>{
      val row = line.split(",")
      HY(row(0).toInt,row(1),row(2).toInt,row(3),row(4))
    })
    result.print()
  }

  case class HY(hy_dm: Int, hy_mc: String, dl_dm: Int, dl_mc: String, yxbz: String)
}
